package com.tjvib.adapter;

import android.content.Context;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemChildClickListener;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.tjvib.R;
import com.tjvib.bean.ReportBean;
import com.tjvib.common.Callback;
import com.tjvib.util.FileUtil;
import com.tjvib.util.ToastUtil;
import com.tjvib.view.activity.ReportActivity;
import com.tjvib.view.dialog.HintDialog;

import java.util.List;

public class ReportAdapter extends BaseQuickAdapter<ReportBean, BaseViewHolder> {

    private Context context;
    private ReportActivity reportActivity;

    public ReportAdapter(Context context, int layoutResId, @Nullable List<ReportBean> data, ReportActivity reportActivity) {
        super(layoutResId, data);
        this.context = context;
        this.reportActivity = reportActivity;
    }

    @Override
    protected void convert(@NonNull BaseViewHolder baseViewHolder, ReportBean reportBean) {
        baseViewHolder.setText(R.id.item_file_tv_name, reportBean.getName());
        baseViewHolder.setText(R.id.item_file_tv_time, reportBean.getTime());

        baseViewHolder.findView(R.id.item_file_ll_del).setOnClickListener(v ->
                reportActivity.showDeleteReportDialog(reportBean));

        baseViewHolder.findView(R.id.item_file_rl).setOnClickListener(v ->
                reportActivity.bottomFileDialog.showBottomDialog(context, reportBean));
    }
}
